package com.guli.oss.controller;

import com.atguigu.commonutils.R;
import com.guli.oss.service.FileService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@CrossOrigin
    @RequestMapping("/eduoss/file")
public class FileUploadController {
    @Resource
    private FileService fileService;
    @PostMapping("/upload")
    public R upload(MultipartFile file){
        String uploadName = fileService.upload(file);
        return R.ok().message("文件上传成功").data("Url",uploadName);
    }

}
